﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using YouthCMS.Data;

namespace YouthCMS
{
    public partial class Groups : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Username"] == null)
            {
                Response.Redirect("Default.aspx");
            }
        }

        public void SubmitGroup(object sender, EventArgs e)
        {
            var groupHandler = new GroupHandler();
            var createdTeacher = false;
            createdTeacher = groupHandler.CreateGroup(txtBoxGroupName.Text, txtBoxGroupStatus.Text, DateTime.Parse(TimePicker1.SelectedTime.ToString()),
                int.Parse(txtBoxStudentMax.Text), int.Parse(txtBoxLessonCount.Text), int.Parse(txtBoxWeeklyHourCount.Text), txtBoxSubjectCode.Text,
                chbWeekDays.SelectedItem.ToString(), txtBoxGroupDescription.Text, int.Parse(txtBoxStudentMinimum.Text));
            if (createdTeacher == true)
            {
                Response.Redirect("~/Default.aspx?created=true");
            }

        }

        protected void ShowSelectedDate(object sender, EventArgs e)
        {

            // txtBoxStartTime.Text = Calendar1.SelectedDate.ToLongTimeString();
        }
    }
}